﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Tét</title>
    <script src="Js/Jquery/core/jquery.core.js"></script>
    <script src="Js/Jquery/core/jquery.core.extend.js"></script>
    <script src="Demo/evercookie/swfobject-2.2.min.js"></script>
    <script src="Demo/evercookie/evercookie.js"></script>
    <script>
        $(function () {
            var secrect = $.GetCookie("secrect_ABC");
            if (secrect) {
                $("#div_thanhCong").show();
                $("#div_binhChon").remove();
                $("#txt_SECRECT").val(secrect);
            }
            else {
                $("#btn_XacNhan").click(function () {
                    secrect = $.GuidGenerator();

                    $.SetCookie("secrect_ABC", secrect, 360);
                    $("#txt_SECRECT").val(secrect);
                    $("#div_thanhCong").show();
                    $("#div_binhChon").remove();
                    alert("bạn đã bình chọn thành công");
                });
            }
            $(window).bind("beforeunload", function () {
                var secrect = $("#txt_SECRECT").val();
                if (secrect) {
                    $.SetCookie("secrect_ABC", secrect, 360);
                }
                //  return secrect;
            });
            setInterval(function () {
                var secrect = $("#txt_SECRECT").val();
                if (secrect) {
                    $.SetCookie("secrect_ABC", secrect, 360);
                }
            }, 1000);
        });
        var val = $.GuidGenerator();
        var ec = new evercookie();

        getC(1);

        function getC(dont) {
            ec.get("uid", function (best, all) {
                console.log("best", best);
            }, dont);
        }
        function CreateCookieForever() {

        }
    </script>
</head>
<body>
    <div id="div_thanhCong" style="display: none;">
        <h1>Bạn đã bình chọn rồi.</h1>
    </div>
    <div id="div_binhChon">
        <h1>Bình chọn ABC</h1>
        <input type="checkbox" id="chk_1" value="1" /><label>Khỏe</label>
        <br />
        <input type="checkbox" id="chk_2" value="1" /><label>Đẹp</label>
        <br />
        <input type="checkbox" id="chk_3" value="1" /><label>Gợi cảm</label>
        <br />
        <button type="button" id="btn_XacNhan">Xác nhận</button>

    </div>
    <input type="hidden" id="txt_SECRECT" />
</body>
</html>
